
package std.regex

import std.collection.*
import std.sync.*

@!APILevel[
    since: "22"
]
public struct Position {
}

@!APILevel[
    since: "22"
]
public struct MatchData {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchString(): String
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchString(group: Int64): String
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchString(group: String): String
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchPosition(): Position
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchPosition(group: Int64): Position
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchPosition(group: String): Position
    
    @Deprecated[message: "Use member function `public func groupCount(): Int64` instead."]
    @!APILevel[
        since: "22"
    ]
    public func groupNumber(): Int64
    
    @!APILevel[
        since: "22"
    ]
    public func groupCount(): Int64
}

@Deprecated[message: "APIs in Matcher have been moved to Regex."]
@!APILevel[
    since: "22"
]
public class Matcher {
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(regex: Regex, input: String)
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func fullMatch(): Option<MatchData>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matchStart(): Option<MatchData>
    
    /**
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func find(): Option<MatchData>
    
    /**
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func find(index: Int64): Option<MatchData>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func findAll(): Option<Array<MatchData>>
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func allCount(): Int64
    
    /**
    * @throws IllegalMemoryException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replace(replacement: String): String
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replace(replacement: String, index: Int64): String
    
    /**
    * @throws IllegalMemoryException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replaceAll(replacement: String): String
    
    /**
    * @throws IllegalMemoryException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replaceAll(replacement: String, limit: Int64): String
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func split(): Array<String>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func split(limit: Int64): Array<String>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func setRegion(beginIndex: Int64, endIndex: Int64): Matcher
    
    @!APILevel[
        since: "22"
    ]
    public func region(): Position
    
    @!APILevel[
        since: "22"
    ]
    public func resetRegion(): Matcher
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func resetString(input: String): Matcher
    
    @!APILevel[
        since: "22"
    ]
    public func getString(): String
}




@!APILevel[
    since: "22"
]
public class Regex {
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(pattern: String, flags: Array<RegexFlag>)
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @Deprecated[message: "Use member funtion `public Regex(let pattern: String, flags: Array<RegexFlag>)` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(pattern: String, option: RegexOption)
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @Deprecated[message: "`Matcher` has been marked as deprecated."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matcher(input: String): Matcher
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func matches(input: String): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func getNamedGroups(): Map<String, Int64>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func find(input: String, group!: Bool = false): Option<MatchData>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func findAll(input: String, group!: Bool = false): Array<MatchData>
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws RegexException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func lazyFindAll(input: String, group!: Bool = false): Iterator<MatchData>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replace(input: String, replacement: String): String
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replace(input: String, replacement: String, index: Int64): String
    
    /**
    * @throws IllegalMemoryException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replaceAll(input: String, replacement: String): String
    
    /**
    * @throws IllegalMemoryException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func replaceAll(input: String, replacement: String, limit: Int64): String
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func split(input: String): Array<String>
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalArgumentException
    * @throws RegexException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func split(input: String, limit: Int64): Array<String>
    
    @!APILevel[
        since: "22"
    ]
    public func string(): String
}

@!APILevel[
    since: "22"
]
public class RegexException <: Exception {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    @!APILevel[
        since: "22"
    ]
    public init(message: String)
}

@!APILevel[
    since: "22"
]
public enum RegexFlag {
    @!APILevel[
        since: "22"
    ]
    IgnoreCase |
    @!APILevel[
        since: "22"
    ]
    MultiLine |
    @!APILevel[
        since: "22"
    ]
    Unicode
}

@Deprecated[message: "Use `public enum RegexFlag` instead."]
@!APILevel[
    since: "22"
]
public class RegexOption <: ToString {
    @!APILevel[
        since: "22"
    ]
    public init()
    
    @!APILevel[
        since: "22"
    ]
    public func ignoreCase(): RegexOption
    
    @!APILevel[
        since: "22"
    ]
    public func multiLine(): RegexOption
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
}

